package com.easonji.admin.form;

import com.easonji.common.base.form.BaseForm;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;


/**
 * @ClassName: UserForm
 * @Description: 用户表单
 * @Author: LiuJun
 * @date: 2018/07/30 14:05:38
 * @Version: 1.0
 * @Copyright: Copyright (c) 2018 - 2019
 */
public class UserForm extends BaseForm {

    private static final long serialVersionUID = 1L;

    /**
     * 账号
     */
    @NotEmpty(message = "账号不能为空")
    @Size(max = 32, message = "请输入32位以内的账号")
    @Pattern(regexp = "[a-z][a-z\\_]*[a-z]", message = "账号只能包含大写、小写和下划线，以字母开头和结尾")
    private String account;

    /**
     * 用户姓名
     */
    @NotEmpty(message = "姓名不能为空")
    @Pattern(regexp = "[\\u4e00-\\u9fa5]{2,10}", message = "请输入2-10位的中文姓名")
    private String name;

    /**
     * 性别
     */
    @NotNull(message = "性别不能为空")
    private Integer sex;

    /**
     * 生日
     */
    @NotEmpty(message = "出生日期不能为空")
    private String birthday;

    /**
     * 手机号码
     */
    @NotEmpty(message = "电话不能为空")
    @Pattern(regexp = "1[3|4|5|8][0-9]\\d{8}", message = "请输入正确的电话")
    private String phoneNum;

    /**
     * 部门ID
     */
    @NotNull(message = "部门不能为空")
    private Integer deptId;


    /**
     * 部门ID
     */
    @NotNull(message = "职务不能为空")
    private Integer post;

    public Integer getPost() {
        return post;
    }

    public void setPost(Integer post) {
        this.post = post;
    }

    /**
     * 账号取得
     * 
     * @return 账号
     */
    public String getAccount() {
        return account;
    }

    /**
     * 账号设定
     * 
     * @param account
     *            账号
     */
    public void setAccount(String account) {
        this.account = account;
    }

    /**
     * 用户姓名取得
     * 
     * @return 用户姓名
     */
    public String getName() {
        return name;
    }

    /**
     * 用户姓名设定
     * 
     * @param name
     *            用户姓名
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 性别取得
     * 
     * @return 性别
     */
    public Integer getSex() {
        return sex;
    }

    /**
     * 性别设定
     * 
     * @param sex
     *            性别
     */
    public void setSex(Integer sex) {
        this.sex = sex;
    }

    /**
     * 生日取得
     * 
     * @return 生日
     */
    public String getBirthday() {
        return birthday;
    }

    /**
     * 生日设定
     * 
     * @param birthday
     *            生日
     */
    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    /**
     * 手机号码取得
     * 
     * @return 手机号码
     */
    public String getPhoneNum() {
        return phoneNum;
    }

    /**
     * 手机号码设定
     * 
     * @param phoneNum
     *            手机号码
     */
    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    /**
     * 部门ID取得
     * 
     * @return 部门ID
     */
    public Integer getDeptId() {
        return deptId;
    }

    /**
     * 部门ID设定
     * 
     * @param deptId
     *            部门ID
     */
    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    @Override
    public String toString() {
        return "{\"account\":\"" + account + "\",\"name\":\"" + name + "\",\"sex\":\"" + sex + "\",\"birthday\":\""
                + birthday + "\",\"phoneNum\":\"" + phoneNum + "\",\"deptId\":\"" + deptId + "\",\"id\":\"" + id
                + "\"} ";
    }
}
